package com.lili.backtrack;

/**
 * @Auther: 李 力
 * @Date: 2024/8/21
 * @Description: 盛最多水的容器
 * @version: 1.0
 */
public class LeetCode11 {

    public static int maxArea(int[] height) {
        int i = 0;
        int j = height.length - 1;
        int max = 0;
        while (i < j) {
            if (height[i] < height[j]) {
                int s = (j - i) * height[i];
                max = Math.max(max, s);
                i++;
            } else {
                int s = (j - i) * height[j];
                max = Math.max(max, s);
                j--;
            }
        }
        return max;
    }

}
